Skip to content

Public trips - Rename fields in host request#7740

Open
nabramow wants to merge 8 commits intodevelopfrom
na/backend/naming-host-req
Open

Public trips - Rename fields in host request#7740
nabramow wants to merge 8 commits intodevelopfrom
na/backend/naming-host-req

Conversation

@nabramow
Copy link
Member

Describe briefly what this PR is doing and why.

Closes #7739

To prepare for public trips, we will first rename surfer_user_id and host_user_id to recipient and initiator. This is because public trips will allow us going both directions so the surfer initiates normally but host initiates with public trips.

Testing

Explain how you tested this PR and give clear steps so the reviewer can replicate.

  • Upgrade and downgrade migrations should work
  • Send a couple host requests and go through reference flow. Should still work exactly as before.

Backend checklist

  • Added tests for any new code or added a regression test if fixing a bug
  • Run the backend locally and it works
  • Added migrations if there are any database changes, rebased onto develop if necessary for linear migration history

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

@vercel
Copy link

vercel bot commented Jan 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
couchers Ready Ready Preview Mar 3, 2026 4:52am

Request Review

@couchersbot
Copy link
Contributor

couchersbot bot commented Feb 22, 2026

Claude finished @nabramow's task in 2m 3s —— View job


Migration Safety Review Complete

  • Get PR diff and identify migration files
  • Read migration file(s) in full
  • Check current production schema
  • Review model changes
  • Evaluate against safety checklist
  • Post review summary

Result: SAFE - The migration 0140_rename_host_request_user_columns_v2.py performs metadata-only column, index, and constraint renames on host_requests. No data modification, no type changes, no new constraints. Full details in the migration review comment.

@nabramow nabramow marked this pull request as ready for review February 22, 2026 04:07
@nabramow nabramow requested a review from aapeliv as a code owner February 22, 2026 04:07
@couchersbot
Copy link
Contributor

couchersbot bot commented Feb 22, 2026

Migration Review

One of our most common issues is migrations that don't work with existing data in production. This is very hard to catch with CI, so we have this bot to check for potential problems.

Overall Risk: SAFE

Files Reviewed

  • 0140_rename_host_request_user_columns_v2.py - Renames 11 columns, 4 indexes, and 2 FK constraints on host_requests table from surfer/host naming to initiator/recipient naming.

Findings

No issues found. All operations are metadata-only in PostgreSQL:

  • ALTER COLUMN ... RENAME TO renames are instant metadata updates, no table rewrite
  • ALTER INDEX ... RENAME TO and ALTER TABLE ... RENAME CONSTRAINT are similarly metadata-only
  • The user_response_rates materialized view references host_requests columns; PostgreSQL automatically updates view definitions when referenced columns are renamed (tracked by attnum), so the view continues to work correctly
  • The composite index ix_host_requests_status_reminder_counts references columns by attnum and remains functional after renames

The downgrade function properly reverses all renames in the correct reverse order.

Summary

This is a safe, metadata-only migration. All 11 column renames, 4 index renames, and 2 FK constraint renames are correctly mapped and match the model changes in host_requests.py. No data modification, no type changes, no constraint additions — just naming updates.

@nabramow nabramow changed the title WIP DRAFT - Rename fields in host request Public trips - Rename fields in host request Feb 22, 2026
@couchersbot
Copy link
Contributor

couchersbot bot commented Feb 22, 2026

Claude finished @nabramow's task in 1m 49s —— View job


Migration Safety Review Complete

  • Get PR diff and identify migration files
  • Read migration file(s) in full
  • Check current production schema
  • Review model changes
  • Evaluate against safety checklist
  • Post review summary

Result: SAFE - The migration 0140_rename_host_request_user_columns_v2.py performs metadata-only column, index, and constraint renames on host_requests. No data modification, no type changes, no new constraints. Full details in the migration review comment.

Copy link
Member

@aapeliv aapeliv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments. let's just change the column names in the host request table in this PR



def create_test_host_request_with_moderation(surfer_token, host_user_id):
def create_test_host_request_with_moderation(surfer_token, recipient_user_id):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not change this one

@couchersbot
Copy link
Contributor

couchersbot bot commented Mar 2, 2026

Claude finished @nabramow's task in 1m 36s —— View job


Migration Safety Review Complete

  • Get PR diff and identify migration files
  • Read migration file(s) in full
  • Check current production schema
  • Review model changes
  • Evaluate against safety checklist
  • Post review summary

Result: SAFE - The migration 0140_rename_host_request_user_columns_v2.py performs metadata-only column, index, and constraint renames on host_requests. No data modification, no type changes, no new constraints. Full details in the migration review comment.

@couchersbot
Copy link
Contributor

couchersbot bot commented Mar 2, 2026

Claude finished @nabramow's task in 1m 40s —— View job


Migration Safety Review Complete

  • Get PR diff and identify migration files
  • Read migration file(s) in full
  • Check current production schema
  • Review model changes
  • Evaluate against safety checklist
  • Post review summary

Result: SAFE - The migration 0140_rename_host_request_user_columns_v2.py performs metadata-only column, index, and constraint renames on host_requests. No data modification, no type changes, no new constraints. Full details in the migration review comment.

@couchersbot
Copy link
Contributor

couchersbot bot commented Mar 3, 2026

Claude finished @nabramow's task in 1m 32s —— View job


Migration Safety Review Complete

  • Get PR diff and identify migration files
  • Read migration file(s) in full
  • Check current production schema
  • Review model changes
  • Evaluate against safety checklist
  • Post review summary

Result: SAFE - The migration 0140_rename_host_request_user_columns_v2.py performs metadata-only column, index, and constraint renames on host_requests. No data modification, no type changes, no new constraints. Full details in the migration review comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change naming of host_user_id and surfer_user_id in HostRequest

2 participants